//
//  LGFollowRecordHeadView.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/6/25.
//

#import "LGFollowRecordHeadView.h"
#import "LGSelectButtonItemView.h"
#import "DatePickerTwoView.h"
#import "LGPickerView.h"
#define placeHolder  @"请输入..."

#define centerPoint  (Screen_W-viewPix(32))/2.0

@interface LGFollowRecordHeadView()<UITextViewDelegate,LGSelectButtonItemDelegate,DatePickerViewDelegate>
/**   */
@property (nonatomic , strong)UIButton *titleBtn;
/**   */
@property (nonatomic , strong)UIView *baseView;
/**  日期 */
@property (nonatomic , strong)UIButton *dateBtn;
@property (nonatomic , strong)UIButton *dateView;
/**  序号 */
@property (nonatomic , strong)UIButton *indexBtn;

/**  登记号 */
@property (nonatomic , strong)UIButton *numberBtn;

/**  姓名 */
@property (nonatomic , strong)UIButton *nameBtn;

/**  医生 */
@property (nonatomic , strong)UIButton *doctorBtn;
@property (nonatomic , strong)UIButton *doctorView;
/**  类型 */
@property (nonatomic , strong)UIButton *typeBtn;
@property (nonatomic , strong)LGSelectButtonItemView *typeView;
/**  问诊需求 */
@property (nonatomic , strong)UIButton *needBtn;
@property (nonatomic , strong)LGSelectButtonItemView *needView;

/**  病情描述 */
@property (nonatomic , strong)UIButton *contentBtn;



/**   */
@property (nonatomic , strong)NSArray *doctorItem;

@end

@implementation LGFollowRecordHeadView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

-(void)setFollowDate:(NSString *)followDate{
    _followDate = followDate;
    self.dateView.selected = YES;
    [self.dateView setTitle:followDate forState:UIControlStateNormal];
}

-(void)setDoctorid:(NSString *)doctorid{
    _doctorid = doctorid;
}

-(void)setDoctorArray:(NSArray *)doctorArray{
    _doctorArray = doctorArray;
    NSMutableArray *tempArray = [NSMutableArray array];
    for (NSInteger i=0; i<doctorArray.count; i++) {
        NSDictionary *tempDic = doctorArray[i];
        [tempArray addObject:LGNSString(tempDic[@"doctor_name"])];
        if([LGNSString(tempDic[@"system_user_id"]) isEqualToString:self.doctorid]){
            self.doctorView.selected = YES;
            [self.doctorView setTitle:LGNSString(tempDic[@"doctor_name"]) forState:UIControlStateNormal];
        }
    }
    self.doctorItem = tempArray;
}
-(void)setTypeArray:(NSArray *)typeArray{
    _typeArray = typeArray;
    self.typeView.itemArray = typeArray;
}

-(void)setNeedArray:(NSArray *)needArray{
    _needArray = needArray;
    self.needView.itemArray = needArray;
}

-(void)setTypeString:(NSString *)typeString{
    _typeString = typeString;
    self.typeView.resultString = typeString;
}

-(void)setNeedResult:(NSArray *)needResult{
    _needResult = needResult;
    self.needView.resultArray = needResult;
}


//日期
-(void)selectVisitDateAction{
    DatePickerTwoView *pickerView = [[DatePickerTwoView alloc]initWithFrame:CGRectMake(0, 0, Screen_W, Screen_H)];
    pickerView.currentDate = self.dateView.titleLabel.text;
    pickerView.delegate = self;
    [[UIApplication sharedApplication].keyWindow addSubview:pickerView];
}

-(void)sendSelectDate:(NSString *)date index:(NSInteger)index{
    self.followDate = date;
}

//医生
-(void)selectDoctorAction{
    [self endEditing:YES];
    if(self.doctorArray.count > 0){
        LGPickerView *pickerView = [[LGPickerView alloc]initWithFrame:CGRectMake(0, 0, Screen_W, Screen_H)];
        pickerView.pickArry = @[self.doctorItem];
        pickerView.selectStr = (self.doctorView.selected == YES)?self.doctorView.titleLabel.text:@"";
        [[UIApplication sharedApplication].keyWindow addSubview:pickerView];
        __weak typeof(self) weakSelf = self;
        pickerView.selectPickViewResult = ^(NSArray *resultArray) {
            weakSelf.doctorView.selected = YES;
            [weakSelf.doctorView setTitle:LGNSString(resultArray[0]) forState:UIControlStateNormal];
            NSInteger index = [weakSelf.doctorItem indexOfObject:LGNSString(resultArray[0])];
            weakSelf.doctorid = LGNSString(weakSelf.doctorArray[index][@"system_user_id"]);
        };
    }
}

//登记号
-(void)textFieldEditingChanged:(UITextField *)textField{
    NSString *content = (textField.text.length>10)?[textField.text substringToIndex:10]:textField.text;
    self.numberTF.text = content;
    if(self.delegate && [self.delegate respondsToSelector:@selector(registerNumberChanged:)]){
        [self.delegate registerNumberChanged:content];
    }
}

//单选 -- 类型
-(void)selectItemResultSting:(NSString *)result tag:(NSInteger)tag{
    self.typeString = result;
}

//多选 -- 问诊需求
-(void)selectItemResultArray:(NSArray *)result tag:(NSInteger)tag{
    self.needResult = result;
}

-(void)selectItemViewHeight:(CGFloat)height tag:(NSInteger)tag{
    LGSelectButtonItemView *itemView = [self viewWithTag:tag];
    [itemView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@(height));
    }];
}


-(void)setContent:(NSString *)content{
    _content = content;
    content = (content.length == 0)?placeHolder:content;
    NSString *colorStr = (content.length == 0 || [content isEqualToString:placeHolder])?@"#999999":@"#333333";
    self.contentTF.attributedText = [content attributeString:@{NSFontAttributeName:LGFont(14),NSForegroundColorAttributeName:[UIColor colorWithString:colorStr]} lineSpacing:5];
    CGSize maxSize = CGSizeMake(self.contentTF.size.width, MAXFLOAT);
    CGSize fitSize = [self.contentTF sizeThatFits:maxSize];
    CGFloat viewHeight = self.contentTF.bounds.size.height;
    CGFloat newHeight = (fitSize.height > viewPix(67))?fitSize.height:viewPix(67);
    if(newHeight != viewHeight){
        [self.contentTF mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.equalTo(@(newHeight));
            if(self.delegate && [self.delegate respondsToSelector:@selector(tableHeadViewHeightChanged:)]){
                [self.delegate tableHeadViewHeightChanged:kMaxY(self.contentTF.frame)+newHeight+viewPix(98)];
            }
        }];
    }
}

- (void)textViewDidBeginEditing:(UITextView *)textView{
    self.contentTF.textColor = [UIColor colorWithString:@"#333333"];
    if([textView.text isEqualToString:placeHolder]){
        self.contentTF.text = @"";
    }
}
- (void)textViewDidEndEditing:(UITextView *)textView{
    self.content = textView.text;
}

- (void)textViewDidChange:(UITextView *)textView{
    NSString *lang = textView.textInputMode.primaryLanguage; // 键盘输入模式
    NSString *content = textView.text;
    NSString *colorStr = (content.length>0 && ![content isEqualToString:placeHolder])?@"#333333":@"#999999";
    if ([lang isEqualToString:@"zh-Hans"]){
        UITextRange *selectedRange = [textView markedTextRange];
        if (!selectedRange) { // 没有高亮
            if(textView.text.length>0){
                textView.attributedText = [textView.text attributeString:@{NSFontAttributeName:LGFont(14),NSForegroundColorAttributeName:[UIColor colorWithString:colorStr]} lineSpacing:5];
            }
            CGSize maxSize = CGSizeMake(self.contentTF.size.width, MAXFLOAT);
            CGSize fitSize = [textView sizeThatFits:maxSize];
            CGFloat viewHeight = self.contentTF.bounds.size.height;
            CGFloat newHeight = (fitSize.height > viewPix(67))?fitSize.height:viewPix(67);
            NSLog(@">>>???>>>%.2f--%.2f",newHeight,viewHeight);
            if(newHeight != viewHeight){
                [self.contentTF mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.height.equalTo(@(newHeight));
                    if(self.delegate && [self.delegate respondsToSelector:@selector(tableHeadViewHeightChanged:)]){
                        [self.delegate tableHeadViewHeightChanged:kMinY(self.contentTF.frame)+newHeight+viewPix(68)];
                    }
                }];
            }
        }
    }else{
        if(textView.text.length>0){
            textView.attributedText = [textView.text attributeString:@{NSFontAttributeName:LGFont(14),NSForegroundColorAttributeName:[UIColor colorWithString:colorStr]} lineSpacing:5];
        }
        CGSize maxSize = CGSizeMake(Screen_W-viewPix(56), MAXFLOAT);
        CGSize fitSize = [textView sizeThatFits:maxSize];
        CGFloat viewHeight = self.contentTF.bounds.size.height;
        CGFloat newHeight = (fitSize.height > viewPix(67))?fitSize.height:viewPix(67);
        NSLog(@">>>???>>>%.2f--%.2f",newHeight,viewHeight);
        if(newHeight != viewHeight){
            [self.contentTF mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.equalTo(@(newHeight));
                if(self.delegate && [self.delegate respondsToSelector:@selector(tableHeadViewHeightChanged:)]){
                    [self.delegate tableHeadViewHeightChanged:kMinY(self.contentTF.frame)+newHeight+viewPix(68)];
                }
            }];
        }
    }
}




#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    self.backgroundColor = [UIColor colorWithString:@"#F9F9F9"];
    [self addSubview:self.titleBtn];
    [self addSubview:self.baseView];
    [self.baseView addSubview:self.dateBtn];
    [self.baseView addSubview:self.indexBtn];
    [self.baseView addSubview:self.dateView];
    [self.baseView addSubview:self.indexTF];
    [self.baseView addSubview:self.numberBtn];
    [self.baseView addSubview:self.nameBtn];
    [self.baseView addSubview:self.numberTF];
    [self.baseView addSubview:self.nameTF];
    [self.baseView addSubview:self.doctorBtn];
    [self.baseView addSubview:self.doctorView];
    [self.baseView addSubview:self.typeBtn];
    [self.baseView addSubview:self.typeView];
    [self.baseView addSubview:self.needBtn];
    [self.baseView addSubview:self.needView];
    [self.baseView addSubview:self.contentBtn];
    [self.baseView addSubview:self.contentTF];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(viewPix(48));
        make.left.equalTo(self).offset(viewPix(16));
        make.right.equalTo(self).offset(-viewPix(16));
        make.bottom.equalTo(self).offset(-viewPix(10));
    }];
    [self.typeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.typeBtn.mas_bottom).offset(viewPix(8));
        make.left.equalTo(self.baseView).offset(viewPix(12));
        make.right.equalTo(self.baseView).offset(-viewPix(12));
        make.height.equalTo(@(10));
    }];
    [self.needBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.height.equalTo(self.dateBtn);
        make.top.equalTo(self.typeView.mas_bottom).offset(viewPix(12));
        make.width.equalTo(@(150));
    }];
    [self.needView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.needBtn.mas_bottom).offset(viewPix(8));
        make.left.right.equalTo(self.typeView);
        make.height.equalTo(@(10));
    }];
    [self.contentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.width.height.equalTo(self.dateBtn);
        make.top.equalTo(self.needView.mas_bottom).offset(viewPix(12));
    }];
    [self.contentTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentBtn.mas_bottom).offset(viewPix(8));
        make.left.equalTo(self.baseView).offset(viewPix(12));
        make.right.equalTo(self.baseView).offset(-viewPix(12));
        make.height.equalTo(@(viewPix(67)));
    }];
}
-(UIButton *)titleBtn{
    if(!_titleBtn){
        _titleBtn = [UIButton buttonWithTitle:@"线下复查" titleFont:LGFontWeight(17, UIFontWeightMedium) textColor:@"#333333" imageName:@"添加随访-线下复查"];
        _titleBtn.frame = CGRectMake(0, viewPix(8), Screen_W, viewPix(40));
        _titleBtn.userInteractionEnabled = NO;
    }
    return _titleBtn;
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.15 radius:10];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UIButton *)dateBtn{
    if(!_dateBtn){
        _dateBtn = [UIButton buttonWithTitle:@"日期" titleFont:LGFontWeight(15, UIFontWeightMedium) textColor:@"#333333" imageName:@"添加随访-必填项"];
        _dateBtn.frame = CGRectMake(viewPix(16), viewPix(14), viewPix(100), viewPix(20));
        _dateBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _dateBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
        _dateBtn.userInteractionEnabled = NO;
    }
    return _dateBtn;
}

-(UIButton *)indexBtn{
    if(!_indexBtn){
        _indexBtn = [UIButton buttonWithTitle:@"序号" titleFont:LGFontWeight(15, UIFontWeightMedium) textColor:@"#333333" imageName:@"添加随访-必填项"];
        _indexBtn.frame = CGRectMake(centerPoint+viewPix(5), kMinY(self.dateBtn.frame), viewPix(100), viewPix(20));
        _indexBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _indexBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
        _indexBtn.userInteractionEnabled = NO;
    }
    return _indexBtn;
}

-(UIButton *)dateView{
    if(!_dateView){
        _dateView = [UIButton buttonWithTitle:@"请选择..." titleFont:LGFont(14) normalColor:@"#BBBBBB" selectColor:@"#333333"];
        _dateView.frame = CGRectMake(viewPix(16), kMaxY(self.dateBtn.frame)+viewPix(8), centerPoint-viewPix(22), viewPix(40));
        _dateView.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _dateView.layer.borderColor = [UIColor colorWithString:@"#E0E0E0"].CGColor;
        _dateView.layer.borderWidth = 1;
        _dateView.cornerRidus = 7;
        _dateView.titleEdgeInsets = UIEdgeInsetsMake(0, 12, 0, 0);
        [_dateView addTarget:self action:@selector(selectVisitDateAction) forControlEvents:UIControlEventTouchUpInside];
        UIImageView *tipView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"grayTipDown12"]];
        tipView.frame = CGRectMake(centerPoint-viewPix(22)-viewPix(24), viewPix(14), viewPix(12), viewPix(12));
        [_dateView addSubview:tipView];
    }
    return _dateView;
}

-(UITextField *)indexTF{
    if(!_indexTF){
        _indexTF = [[UITextField alloc]initWithFrame:CGRectMake(kMinX(self.indexBtn.frame), kMinY(self.dateView.frame), centerPoint-viewPix(22), viewPix(40))];
        _indexTF.layer.borderColor = [UIColor colorWithString:@"#E0E0E0"].CGColor;
        _indexTF.tintColor = [UIColor colorWithString:@"#333333"];
        _indexTF.textColor = [UIColor colorWithString:@"#333333"];
        _indexTF.textAlignment = NSTextAlignmentLeft;
        _indexTF.keyboardType = UIKeyboardTypeNumberPad;
        _indexTF.placeholder = @"请输入...";
        _indexTF.layer.borderWidth = 1;
        _indexTF.cornerRidus = 7;
        _indexTF.font = LGFont(14);
        _indexTF.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 12, viewPix(40))];
        _indexTF.leftViewMode = UITextFieldViewModeAlways;

        UILabel *unitLabel = [UILabel lableWithText:@"号" colorString:@"#666666" textFont:LGFont(14) textAlignment:NSTextAlignmentRight lines:1];
        unitLabel.frame = CGRectMake(centerPoint-viewPix(22)-viewPix(30), 0, viewPix(15), viewPix(40));
        [_indexTF addSubview:unitLabel];
    }
    return _indexTF;
}

-(UIButton *)numberBtn{
    if(!_numberBtn){
        _numberBtn = [UIButton buttonWithTitle:@"登记号" titleFont:LGFontWeight(15, UIFontWeightMedium) textColor:@"#333333" imageName:@"添加随访-必填项"];
        _numberBtn.frame = CGRectMake(viewPix(16), kMaxY(self.dateView.frame)+viewPix(12), viewPix(100), viewPix(20));
        _numberBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _numberBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
        _numberBtn.userInteractionEnabled = NO;
    }
    return _numberBtn;
}

-(UIButton *)nameBtn{
    if(!_nameBtn){
        _nameBtn = [UIButton buttonWithTitle:@"姓名" titleFont:LGFontWeight(15, UIFontWeightMedium) textColor:@"#333333" imageName:@"添加随访-必填项"];
        _nameBtn.frame = CGRectMake(kMinX(self.indexBtn.frame), kMinY(self.numberBtn.frame), viewPix(100), viewPix(20));
        _nameBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _nameBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
        _nameBtn.userInteractionEnabled = NO;
    }
    return _nameBtn;
}


-(UITextField *)numberTF{
    if(!_numberTF){
        _numberTF = [[UITextField alloc]initWithFrame:CGRectMake(kMinX(self.dateView.frame), kMaxY(self.numberBtn.frame)+viewPix(8), centerPoint-viewPix(22), viewPix(40))];
        _numberTF.layer.borderColor = [UIColor colorWithString:@"#E0E0E0"].CGColor;
        _numberTF.tintColor = [UIColor colorWithString:@"#333333"];
        _numberTF.textColor = [UIColor colorWithString:@"#333333"];
        _numberTF.textAlignment = NSTextAlignmentLeft;
        _numberTF.keyboardType = UIKeyboardTypeNumberPad;
        _numberTF.placeholder = @"请输入...";
        _numberTF.layer.borderWidth = 1;
        _numberTF.cornerRidus = 7;
        _numberTF.font = LGFont(14);
        _numberTF.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 12, viewPix(40))];
        _numberTF.leftViewMode = UITextFieldViewModeAlways;
        [_numberTF addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
    }
    return _numberTF;
}

-(UITextField *)nameTF{
    if(!_nameTF){
        _nameTF = [[UITextField alloc]initWithFrame:CGRectMake(kMinX(self.nameBtn.frame), kMinY(self.numberTF.frame), centerPoint-viewPix(22), viewPix(40))];
        _nameTF.layer.borderColor = [UIColor colorWithString:@"#E0E0E0"].CGColor;
        _nameTF.tintColor = [UIColor colorWithString:@"#333333"];
        _nameTF.textColor = [UIColor colorWithString:@"#333333"];
        _nameTF.textAlignment = NSTextAlignmentLeft;
        _nameTF.placeholder = @"请输入...";
        _nameTF.layer.borderWidth = 1;
        _nameTF.cornerRidus = 7;
        _nameTF.font = LGFont(14);
        _nameTF.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 12, viewPix(40))];
        _nameTF.leftViewMode = UITextFieldViewModeAlways;
    }
    return _nameTF;
}


-(UIButton *)doctorBtn{
    if(!_doctorBtn){
        _doctorBtn = [UIButton buttonWithTitle:@"医生" titleFont:LGFontWeight(15, UIFontWeightMedium) textColor:@"#333333" imageName:@"添加随访-必填项"];
        _doctorBtn.frame = CGRectMake(viewPix(16), kMaxY(self.numberTF.frame)+viewPix(12), viewPix(100), viewPix(20));
        _doctorBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _doctorBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
        _doctorBtn.userInteractionEnabled = NO;
    }
    return _doctorBtn;
}

-(UIButton *)doctorView{
    if(!_doctorView){
        _doctorView = [UIButton buttonWithTitle:@"请选择..." titleFont:LGFont(14) normalColor:@"#BBBBBB" selectColor:@"#333333"];
        _doctorView.frame = CGRectMake(viewPix(16), kMaxY(self.doctorBtn.frame)+viewPix(8), centerPoint-viewPix(22), viewPix(40));
        _doctorView.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _doctorView.layer.borderColor = [UIColor colorWithString:@"#E0E0E0"].CGColor;
        _doctorView.layer.borderWidth = 1;
        _doctorView.cornerRidus = 7;
        _doctorView.titleEdgeInsets = UIEdgeInsetsMake(0, 12, 0, 0);
        [_doctorView addTarget:self action:@selector(selectDoctorAction) forControlEvents:UIControlEventTouchUpInside];
        UIImageView *tipView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"grayTipDown12"]];
        tipView.frame = CGRectMake(centerPoint-viewPix(22)-viewPix(24), viewPix(14), viewPix(12), viewPix(12));
        [_doctorView addSubview:tipView];
    }
    return _doctorView;
}

-(UIButton *)typeBtn{
    if(!_typeBtn){
        _typeBtn = [UIButton buttonWithTitle:@"类型" titleFont:LGFontWeight(15, UIFontWeightMedium) textColor:@"#333333" imageName:@"添加随访-必填项"];
        _typeBtn.frame = CGRectMake(viewPix(16), kMaxY(self.doctorView.frame)+viewPix(12), viewPix(100), viewPix(20));
        _typeBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _typeBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
        _typeBtn.userInteractionEnabled = NO;
    }
    return _typeBtn;
}

-(LGSelectButtonItemView *)typeView{
    if(!_typeView){
        _typeView = [[LGSelectButtonItemView alloc]initWithFrame:CGRectMake(viewPix(12), kMaxY(self.typeBtn.frame)+viewPix(8), Screen_W-viewPix(56), 0)];
        _typeView.delegate = self;
        _typeView.tag = 10000;
        _typeView.type = @"radio";
    }
    return _typeView;
}

-(UIButton *)needBtn{
    if(!_needBtn){
        _needBtn = [UIButton buttonWithTitle:@"问诊需求(可多选)" titleFont:LGFontWeight(15, UIFontWeightMedium) textColor:@"#333333" imageName:@"添加随访-必填项"];
        _needBtn.frame = CGRectMake(viewPix(16), kMaxY(self.doctorView.frame)+viewPix(12), viewPix(150), viewPix(20));
        _needBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _needBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
        _needBtn.userInteractionEnabled = NO;
        NSMutableAttributedString *attrbutString = [@"问诊需求(可多选)" attributeString:@{NSFontAttributeName:LGFont(15)} range:NSMakeRange(4, 5)];
        [_needBtn setAttributedTitle:attrbutString forState:UIControlStateNormal];
    }
    return _needBtn;
}

-(LGSelectButtonItemView *)needView{
    if(!_needView){
        _needView = [[LGSelectButtonItemView alloc]initWithFrame:CGRectMake(viewPix(12), kMaxY(self.needBtn.frame)+viewPix(8), Screen_W-viewPix(56), 0)];
        _needView.delegate = self;
        _needView.tag = 10001;
        _needView.type = @"multiple";
    }
    return _needView;
}

-(UIButton *)contentBtn{
    if(!_contentBtn){
        _contentBtn = [UIButton buttonWithTitle:@"病情描述" titleFont:LGFontWeight(15, UIFontWeightMedium) textColor:@"#333333" imageName:@"添加随访-必填项"];
        _contentBtn.frame = CGRectMake(viewPix(16), kMaxY(self.needView.frame)+viewPix(12), viewPix(100), viewPix(20));
        _contentBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _contentBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
        _contentBtn.userInteractionEnabled = NO;
    }
    return _contentBtn;
}


-(UITextView *)contentTF{
    if(!_contentTF){
        _contentTF = [[UITextView alloc]initWithFrame:CGRectMake(viewPix(12), kMaxY(self.contentBtn.frame)+viewPix(8), Screen_W-viewPix(56), viewPix(67))];
        _contentTF.layer.borderColor = [UIColor colorWithString:@"#E3E3E3"].CGColor;
        _contentTF.backgroundColor = [UIColor colorWithString:@"#FAFAFA"];
        _contentTF.tintColor = [UIColor colorWithString:@"#333333"];
        _contentTF.textColor = [UIColor colorWithString:@"#999999"];
        _contentTF.textAlignment = NSTextAlignmentLeft;
        _contentTF.layer.borderWidth = 1;
        _contentTF.layer.cornerRadius = 5;
        _contentTF.font = LGFont(14);
        _contentTF.delegate = self;
        _contentTF.text = placeHolder;
    }
    return _contentTF;
}

@end
